/*
 * Group.java
 */
package com.sun.demo.addressbook;

/**
 *
 */
public class PartGroup {
    private int partId;
    private int groupId;
    private static final int PRIMENO = 37;
    
    public PartGroup() {
    }
    
    public PartGroup(int partId, int groupId) {
        setPartId(partId);
        setGroupId(groupId);
    }

    public int getPartId() {
        return partId;
    }

    public void setPartId(int partId) {
        this.partId = partId;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public int hashCode() {
        int value = 1;
        value = value*PRIMENO + 36;
        
        // don't use the id since this is generated by db
        return value;
    }
    
    public boolean equals(Object other) {
        boolean bEqual = false;
        if (this == other) {
            bEqual = true;
        } else if (other instanceof Address) {
//            Address thatPart = (Address) other;
/*            if ((lastName == null ? thatPart.lastName == null : lastName.equalsIgnoreCase(thatPart.lastName)) &&
                    (firstName == null ? thatPart.firstName == null : firstName.equalsIgnoreCase(thatPart.firstName)) &&
                    (middleName == null ? thatPart.middleName == null : middleName.equalsIgnoreCase(thatPart.middleName)) &&
                    (phone == null ? thatPart.phone == null : phone.equalsIgnoreCase(thatPart.phone)) &&
                    (email == null ? thatPart.email == null : email.equalsIgnoreCase(thatPart.email)) &&
                    (address1 == null ? thatPart.address1 == null : address1.equalsIgnoreCase(thatPart.address1)) &&
                    (address2 == null ? thatPart.address2 == null : address2.equalsIgnoreCase(thatPart.address2)) &&
                    (city == null ? thatPart.city == null : city.equalsIgnoreCase(thatPart.city)) &&
                    (state == null ? thatPart.state == null : state.equalsIgnoreCase(thatPart.state)) &&
                    (postalCode == null ? thatPart.postalCode == null : postalCode.equalsIgnoreCase(thatPart.postalCode)) &&
                    (country == null ? thatPart.country == null : country.equalsIgnoreCase(thatPart.country))) {
                // don't use id in determining equality
 */               
                bEqual = true;
//            }
        }
        return bEqual;
    }
}
